/**
 *
 */
if(typeof (module) !="undefined"){
    module.exports = FStroke; //

    var FEffectBase = require('./FEffectBase');
    var FGraphBase = require('./FGraphBase');
    var FColor = require('./FColor');

}



function FStroke()
{
    FGraphBase.call(this);
    this.type = FEffectBase.prototype.TYPE_STROKE;

    this.lc = FStroke.prototype.LINE_CAP_BUTT;
    this.lj = FStroke.prototype.LINE_JOIN_BEVEL;
    this.m = 0;
    this.w = 0;
    this.c = null;

}
FStroke.prototype = new FGraphBase();

// line cap type： "butt"，"round"，"square"
FStroke.prototype.LINE_CAP_BUTT	= 1;
FStroke.prototype.LINE_CAP_ROUND	= 2;
FStroke.prototype.LINE_CAP_SQUARE	= 3;

// line join type："miter"，"round"，"bevel"
FStroke.prototype.LINE_JOIN_MITER	= 1;
FStroke.prototype.LINE_JOIN_ROUND	= 2;
FStroke.prototype.LINE_JOIN_BEVEL	= 3;


// 从json对象(注意不是json字符串)中解析
FStroke.prototype.fromJson = function(jsonObj, versionId){
    FGraphBase.prototype.fromJson.call(this,jsonObj,versionId);

    this.lc = jsonObj.lc;
    this.lj = jsonObj.lj;
    this.m = jsonObj.m;
    this.w = jsonObj.w;
    if(jsonObj.hasOwnProperty("c")){
        this.c = new FColor();
        this.c.fromJson(jsonObj.c, versionId);
    }

}
// 转换成json字符串
FStroke.prototype.toJson = function(){
    // 去掉父json字符串的头尾
    var superJson = FGraphBase.prototype.toJson.call(this);
    superJson = superJson.substr(1,superJson.length-2);

    var ret = '{';
    ret +=superJson;

    // lc
    ret +=',';
    ret += '"lc":';
    ret += this.lc;
    // lj
    ret +=',';
    ret += '"lj":';
    ret += this.lj;
    // m
    ret +=',';
    ret += '"m":';
    ret += this.m;
    // w
    ret +=',';
    ret += '"w":';
    ret += this.w;
    // c
    if(this.c){
        ret +=',';
        ret += '"c":';
        ret += this.c.toJson();
    }

    ret+='}';
    return ret;
}

